<template>
  <view class="tab-bar">
    <view class="tab-item" @click="goHome">
      <image
        src="/static/img/home.svg"
        mode="aspectFit"
        class="tab-icon"
      ></image>
      <text class="tab-text">首页</text>
    </view>
    <view class="publish-btn" @click="goToPublish">
      <image
        src="/static/img/publish.svg"
        mode="aspectFit"
        class="publish-icon"
      ></image>
      <text class="publish-text">发布</text>
    </view>
    <view class="tab-item" @click="gotoPersonal">
      <image src="/static/img/my.svg" mode="aspectFit" class="tab-icon"></image>
      <text class="tab-text">我的</text>
    </view>
  </view>
</template>

<script setup>
  const goHome = () => {
    uni.redirectTo({
      url: "/pages/index/index",
    });
  };
  const gotoPersonal = () => {
    uni.redirectTo({
      url: "/pages/personal/personal",
    });
  };

  const goToPublish = () => {
    uni.navigateTo({
      url: "/pages/publish/publish",
    });
  };
</script>

<style lang="scss" scoped>
  .tab-bar {
    position: fixed;
    bottom: 50rpx;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    height: 120rpx;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 60rpx;
    display: flex;
    align-items: center;
    justify-content: space-around;
    box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.1);

    .tab-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      flex: 1;

      .tab-icon {
        width: 48rpx;
        height: 48rpx;
        margin-bottom: 4rpx;
      }

      .tab-text {
        font-size: 24rpx;
        color: #333;
      }
    }

    .publish-btn {
      display: flex;
      flex-direction: column;
      align-items: center;
      transform: translateY(-20rpx);

      .publish-icon {
        width: 80rpx;
        height: 80rpx;
        margin-bottom: 4rpx;
      }

      .publish-text {
        font-size: 24rpx;
        color: #333;
      }
    }
  }
</style>
